package cn.hospital.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class FamtDate {
    static SimpleDateFormat sdfDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    static SimpleDateFormat sdfDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");

    public static String fordate(Date date) {
        String dateString = "";
        if (date != null) {
            dateString = sdfDateFormat.format(date);
        }
        return dateString;
    }

    public static String fordate1(Date date) {
        String dateString = "";
        if (date != null) {
            dateString = sdfDateFormat1.format(date);
        }
        return dateString;
    }

    public static Date stringToDate(String dateString) throws ParseException {
        return sdfDateFormat.parse(dateString);
    }
}
